/*
 * Created on 26/02/2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.potiorb.orb.invoke;

import org.potiorb.orb.portable.ObjectRef;
import org.potiorb.orb.giop.GIOPMessageHeader;
import org.potiorb.orb.giop.GIOPMessageReply;
import org.potiorb.orb.iiop.EndPoint;
import java.net.SocketException;

public class Invoker {
	private EndPointManager m_EndPointManager;

        public Invoker()
        {
          m_EndPointManager = new EndPointManager();
        }
	public GIOPMessageReply Invoke(GIOPMessageHeader msg, ObjectRef pObjectRef){
          try{
            EndPoint existEndPoint = m_EndPointManager.GetEndpoint(pObjectRef);
            existEndPoint.Send(msg);
            return (GIOPMessageReply) existEndPoint.Receive();
          }catch (SocketException e){
                return null;
          }
	}
}
